[qemu patches] Update patches for changeset 11209:9bb6c1c1890a.
authorChristian Limpach <Christian.Limpach@xensource.com>
Sun, 20 Aug 2006 23:01:11 +0000 (00:01 +0100)
committerChristian Limpach <Christian.Limpach@xensource.com>
Sun, 20 Aug 2006 23:01:11 +0000 (00:01 +0100)
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
tools/ioemu/patches/qemu-fix-write-to-disk-synchronous [deleted file]
tools/ioemu/patches/qemu-tunable-ide-write-cache [new file with mode: 0644]
tools/ioemu/patches/series

diff --git a/tools/ioemu/patches/qemu-fix-write-to-disk-synchronous b/tools/ioemu/patches/qemu-fix-write-to-disk-synchronous
deleted file mode 100644 (file)
index 62b4f5c..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-Index: ioemu/block-vmdk.c
-===================================================================
---- ioemu.orig/block-vmdk.c    2006-08-17 19:37:35.737593169 +0100
-+++ ioemu/block-vmdk.c 2006-08-17 19:50:28.884943317 +0100
-@@ -96,7 +96,7 @@
-     uint32_t magic;
-     int l1_size;
--    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
-+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (fd < 0) {
-         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-         if (fd < 0)
-Index: ioemu/block-qcow.c
-===================================================================
---- ioemu.orig/block-qcow.c    2006-08-17 19:37:35.737593169 +0100
-+++ ioemu/block-qcow.c 2006-08-17 19:50:28.885943206 +0100
-@@ -95,7 +95,7 @@
-     int fd, len, i, shift;
-     QCowHeader header;
-     
--    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
-+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (fd < 0) {
-         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-         if (fd < 0)
-Index: ioemu/block-bochs.c
-===================================================================
---- ioemu.orig/block-bochs.c   2006-08-17 19:37:35.737593169 +0100
-+++ ioemu/block-bochs.c        2006-08-17 19:50:28.885943206 +0100
-@@ -91,7 +91,7 @@
-     int fd, i;
-     struct bochs_header bochs;
--    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
-+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (fd < 0) {
-         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-         if (fd < 0)
-Index: ioemu/block.c
-===================================================================
---- ioemu.orig/block.c 2006-08-17 19:50:18.872050063 +0100
-+++ ioemu/block.c      2006-08-17 19:50:28.885943206 +0100
-@@ -685,7 +685,7 @@
-     int rv;
- #endif
--    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
-+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (fd < 0) {
-         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-         if (fd < 0)
-Index: ioemu/block-cow.c
-===================================================================
---- ioemu.orig/block-cow.c     2006-08-17 19:37:35.738593058 +0100
-+++ ioemu/block-cow.c  2006-08-17 19:50:28.886943095 +0100
-@@ -69,7 +69,7 @@
-     struct cow_header_v2 cow_header;
-     int64_t size;
--    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
-+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (fd < 0) {
-         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-         if (fd < 0)
-Index: ioemu/block-cloop.c
-===================================================================
---- ioemu.orig/block-cloop.c   2006-08-17 19:37:35.737593169 +0100
-+++ ioemu/block-cloop.c        2006-08-17 19:50:28.886943095 +0100
-@@ -55,7 +55,7 @@
-     BDRVCloopState *s = bs->opaque;
-     uint32_t offsets_size,max_compressed_block_size=1,i;
--    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-+    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC);
-     if (s->fd < 0)
-         return -1;
-     bs->read_only = 1;
diff --git a/tools/ioemu/patches/qemu-tunable-ide-write-cache b/tools/ioemu/patches/qemu-tunable-ide-write-cache
new file mode 100644 (file)
index 0000000..a5d8f0b
--- /dev/null
@@ -0,0 +1,57 @@
+Index: ioemu/hw/ide.c
+===================================================================
+--- ioemu.orig/hw/ide.c        2006-08-20 22:22:36.000000000 +0100
++++ ioemu/hw/ide.c     2006-08-20 23:56:13.000000000 +0100
+@@ -305,6 +305,7 @@
+     PCIDevice *pci_dev;
+     struct BMDMAState *bmdma;
+     int drive_serial;
++    int write_cache;
+     /* ide regs */
+     uint8_t feature;
+     uint8_t error;
+@@ -789,6 +790,9 @@
+     }
+     ide_set_sector(s, sector_num + n);
+     
++    if (!s->write_cache)
++        bdrv_flush(s->bs);
++    
+ #ifdef TARGET_I386
+     if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
+         /* It seems there is a bug in the Windows 2000 installer HDD
+@@ -863,6 +867,10 @@
+         transfer_size -= len;
+         phys_addr += len;
+     }
++    /* Ensure the data hit disk before telling the guest OS so. */
++    if (!s->write_cache)
++        bdrv_flush(s->bs);
++
+     return transfer_size1 - transfer_size;
+ }
+@@ -1672,7 +1680,15 @@
+             /* XXX: valid for CDROM ? */
+             switch(s->feature) {
+             case 0x02: /* write cache enable */
++                s->write_cache = 1;
++                s->status = READY_STAT | SEEK_STAT;
++                ide_set_irq(s);
++                break;
+             case 0x82: /* write cache disable */
++                s->write_cache = 0;
++                s->status = READY_STAT | SEEK_STAT;
++                ide_set_irq(s);
++                break;
+             case 0xaa: /* read look-ahead enable */
+             case 0x55: /* read look-ahead disable */
+                 s->status = READY_STAT | SEEK_STAT;
+@@ -2090,6 +2106,7 @@
+         s->irq = irq;
+         s->sector_write_timer = qemu_new_timer(vm_clock, 
+                                                ide_sector_write_timer_cb, s);
++        s->write_cache = 0;
+         ide_reset(s);
+     }
+ }
index 37702a442e49e922b1131aa49916eb8493cde8b8..dcb950d6615997d56f5c8d21fc3f093292053f2b 100644 (file)
@@ -39,8 +39,8 @@ xenstore-block-device-config
 xenstore-write-vnc-port
 qemu-allow-disable-sdl
 qemu-fix-memset-args
-qemu-fix-write-to-disk-synchronous
 xen-support-buffered-ioreqs
 qemu-daemonize
 xen-platform-device
 qemu-bootorder
+qemu-tunable-ide-write-cache